import { renderWithHooks } from "./hook";
import { updateNode } from "./utils";
import { reconcileChildren } from './reconcileFiber'

/**
 * 递归创建dom节点
 * 并更新dom节点
 */

export function updateHostComponent(wip) {
  if (!wip.stateNode) {
    wip.stateNode = document.createElement(wip.type);
    updateNode(wip.stateNode, {}, wip.props);
  }

  reconcileChildren(wip, wip.props.children);
}
export function updateFunctionComponent(wip) {
  renderWithHooks(wip)
  const children = wip.type(wip.props);
  reconcileChildren(wip, children);
}

export function updateFragmentComponent(wip) {
  reconcileChildren(wip, wip.props.children);
}



